from google.appengine.api import users
from google.appengine.ext import webapp

from links import Links

class Globals(webapp.RequestHandler):
    user = None
    user_msg = None
    user_is_admin = False
    links = None
    
    def __init__(self, mainPage = False):
        self.user = user = users.get_current_user()
        if self.user:
            self.user_msg = ('<b>%s</b> | <a href="%s">Sign out</a>' % 
                (user.nickname(), users.create_logout_url("/")))
            self.user_is_admin = users.is_current_user_admin()
        else:
            if mainPage:
                self.user_msg = ('<a href="%s">Sign In</a>' % 
                                 (users.create_login_url('/')))
            else:
                self.redirect('/')
        
        self.links = Links().get()
        
    def get(self):
        pass
